package com.zq.it.dao.impl.admin;

import java.math.BigInteger;
import java.util.Collection;
import java.util.Date;
import java.util.List;

import com.zq.it.dao.admin.AdminDao;
import com.zq.it.dao.impl.BaseDao;
import com.zq.it.pojo.Admin;

public  class AdminDaoImpl extends BaseDao<Admin> implements AdminDao {
  /*public static final Logger logger=t(AdminDaoImpl.class);*/
	@Override
	public void saveAdminEty(Admin academty){
    	getHibernateTemplate().save(academty);
	}
	@Override
	public void deleteAdminEtyByID(BigInteger id){	
		deleteEntity("delete Admin as adm where adm.id="+id);
	}
	public void saveOrUpdateAdminEty(Admin admin){
		getHibernateTemplate().saveOrUpdate(admin);
	}
	@Override
	public List<Admin> findAdminEtyList() {
		return getHibernateTemplate().find("from Admin");
		// TODO Auto-generated method stub
	
	}

	@Override
	public List findAdminEtyById(BigInteger id) {
        System.out.println(id);
		return getHibernateTemplate().find("from Admin adm where adm.id=?",id);
		// TODO Auto-generated method stub
	
	}

	@Override
	public List findAdminEtyByName(String name) {
		return getHibernateTemplate().find("from Admin as adm where adm.adminName like '%"+name+"%'");
		// TODO Auto-generated method stub
	
	}

//	@Override
//	public void updateAdminByID(BigInteger id) {
//		getHibernateTemplate().update(entity);
//		// TODO Auto-generated method stub
//		
//	}

	@Override
	public void updateAdminEty(Admin admin) {
		getHibernateTemplate().update(admin);
		// TODO Auto-generated method stub
		
	}
	@Override
	public List findAdminEtyByDate(Date date){
		// TODO Auto-generated method stub
		return getHibernateTemplate().find("from Admin where createTime=?",date);
	}
	@Override
	public List findAdminEtyByExmp(Admin admin) {
		// TODO Auto-generated method stub
		return getHibernateTemplate().findByExample(admin);
	}
	@Override
	public void deleteAllEty(java.util.Collection<Admin> collection){
		getHibernateTemplate().deleteAll(collection);
	}
	@Override
	public void deleteAdminEtyByObj(Admin admin){
		getHibernateTemplate().delete(admin);
	}
	@Override
	public void saveAdminEtyList(Collection<Admin> collection){
		getHibernateTemplate().saveOrUpdateAll(collection);
	}
	@Override
	public List findAcmyNameAndId() {
		// TODO Auto-generated method stub
		return getHibernateTemplate().find("select adminId,adminName from Admin");
	}
	
}
